package csvm_v1.coins;

/**
 * Nickel adalah kelas konkrit turunan dari Coin. Nickel bernilai 5, dengan
 * keterangan dimensi seperti yang tertera pada kelas.
 *
 * @author Muqtafi Akhmad
 */
public class Nickel extends Coin {

    /**
     * ukuran koin Nickel
     */
    private static final float nickelSize = (float) 21.21;
    /**
     * berat koin Nickel
     */
    private static final float nickelWeight = 5;
    /**
     * ketebalan koin Nickel
     */
    private static final float nickelThickness = (float) 1.95;
    /**
     * keterangan apakah koin Nickel bergerigi
     */
    private static final boolean nickelIsSerratedEdge = true;
    /**
     * nilai koin Nickel
     */
    private static final int nickelValue = 5;

    /**
     * konstruktor koin Nickel
     */
    public Nickel() {
        super(nickelSize, nickelWeight, nickelThickness, nickelIsSerratedEdge, nickelValue);
    }

    /**
     * mendeteksi apakah objek yang dimasukkan adalah koin Nickel
     *
     * @param size ukuran
     * @param weight berat
     * @param thickness ketebalan
     * @param isSerratedEdge keterangan bergerigi
     * @return apakah Nickel
     */
    public static boolean isNickel(float size, float weight, float thickness, boolean isSerratedEdge) {
        return (Math.abs(size - nickelSize) < dimensionTolerance * nickelSize) && (Math.abs(weight - nickelWeight) < dimensionTolerance * nickelWeight) && (Math.abs(thickness - nickelThickness) < dimensionTolerance * nickelThickness) && isSerratedEdge == nickelIsSerratedEdge;
    }

    @Override
    public String getCoinName() {
        return "Nickel";
    }
}
